package com.erpanderp.wam.tm.model.service;

import org.hibernate.FlushMode;
import org.hibernate.Session;

import com.erpanderp.wam.tm.model.entity.Technology;
import com.erpanderp.wam.util.HibernateUtil;

public class TechnologyDAO {
	
	public Technology createTechnology(Technology technology){
		try{
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.getTransaction().begin();
		System.out.println("FLUSH MODE: " + session.getFlushMode());
		session.setFlushMode(FlushMode.COMMIT);
		session.save(technology);
		session.getTransaction().commit();
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
		
		return technology;
		
	}

}
